primes = [1]*1000001
ned = 1
now_primes = 2
prime1 = []
while ned<=1000000:
    if primes[now_primes]:
        prime1.append(now_primes)
        ned = now_primes*ned
        k = 2
        while k*now_primes<=1000000:
            primes[k*now_primes]=0
            k += 1
    now_primes += 1

print(ned)
print(prime1)